package org.obsidianrad.server.services.echo;

import java.util.Map;


import org.obsidianrad.server.services.user.rolemanager.RoleManager;
import org.springframework.security.GrantedAuthority;

public class EchoImpl implements Echo{

	private RoleManager rm;

	public String echo(String message){
		return "ECHO: " + message;
	}

	public String[] getAuthorities(){
		GrantedAuthority[] grantedAuthorities = rm.getGrantedAuthorities();
		String[] retval = new String[grantedAuthorities.length];
		int i = 0;
		for(GrantedAuthority ga: grantedAuthorities){
			retval[i++] = ga.getAuthority();
		}
		return retval;
	}
		
	public RoleManager getRm() {
		return rm;
	}

	public void setRm(RoleManager rm) {
		this.rm = rm;
	}

	@Override
	public Map<String, Map<String, String>> getDataForAuth() {
		return rm.getDataForAuth();
	}

}
